<?php

/**
 * Aviso form base class.
 *
 * @method Aviso getObject() Returns the current form's model object
 *
 * @package    asindo
 * @subpackage form
 * @author     Ignacio Calvo
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 24171 2009-11-19 16:37:50Z Kris.Wallsmith $
 */
abstract class BaseAvisoForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'                 => new sfWidgetFormInputHidden(),
      'paciente_id'        => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Paciente'), 'add_empty' => true)),
      'franja_id'          => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Franja'), 'add_empty' => true)),
      'fecha'              => new sfWidgetFormDateTime(),
      'tipo_via'           => new sfWidgetFormInputText(),
      'via'                => new sfWidgetFormInputText(),
      'cp'                 => new sfWidgetFormInputText(),
      'numero'             => new sfWidgetFormInputText(),
      'piso'               => new sfWidgetFormInputText(),
      'letra'              => new sfWidgetFormInputText(),
      'poblacion'          => new sfWidgetFormInputText(),
      'provincia'          => new sfWidgetFormInputText(),
      'pediatra_asindo_id' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Pediatra'), 'add_empty' => true)),
      'honorarios'         => new sfWidgetFormInputText(),
      'observaciones'      => new sfWidgetFormTextarea(),
      'created_at'         => new sfWidgetFormDateTime(),
      'updated_at'         => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'id'                 => new sfValidatorDoctrineChoice(array('model' => $this->getModelName(), 'column' => 'id', 'required' => false)),
      'paciente_id'        => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Paciente'), 'required' => false)),
      'franja_id'          => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Franja'), 'required' => false)),
      'fecha'              => new sfValidatorDateTime(array('required' => false)),
      'tipo_via'           => new sfValidatorString(array('max_length' => 20, 'required' => false)),
      'via'                => new sfValidatorString(array('max_length' => 100, 'required' => false)),
      'cp'                 => new sfValidatorString(array('max_length' => 5, 'required' => false)),
      'numero'             => new sfValidatorInteger(array('required' => false)),
      'piso'               => new sfValidatorInteger(array('required' => false)),
      'letra'              => new sfValidatorString(array('max_length' => 2, 'required' => false)),
      'poblacion'          => new sfValidatorString(array('max_length' => 100, 'required' => false)),
      'provincia'          => new sfValidatorString(array('max_length' => 100, 'required' => false)),
      'pediatra_asindo_id' => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Pediatra'), 'required' => false)),
      'honorarios'         => new sfValidatorNumber(array('required' => false)),
      'observaciones'      => new sfValidatorString(array('max_length' => 1000, 'required' => false)),
      'created_at'         => new sfValidatorDateTime(),
      'updated_at'         => new sfValidatorDateTime(),
    ));

    $this->widgetSchema->setNameFormat('aviso[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Aviso';
  }

}
